<?php
$model = new RegistrationForm;
?>
<div class="common whiteBg">
    <div class="formElements">
        <div id="registeractiveID">                       

            <?php
            $form = $this->beginWidget('GxActiveForm', array(
                'id' => 'registrationpop-form',
                'action' => Yii::app()->createUrl('user/registrationpop'),
                'enableClientValidation' => true,
                'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => true, 'enableAjaxValidation' => true,),
                'htmlOptions' => array('class' => 'remmarginB'),
                    ));
            ?>							

            <fieldset>
                <div class="col-3">
                    <div class="common">
                        <div class="col col1">
                            <label>Email Address <span class="required">*</span></label>
                            <?php echo CHtml::activeTextField($model, 'username', array('class' => 'field')); ?>
                            <?php echo $form->error($model, 'username'); ?>
                        </div>
                        <div class="col col2">
                            <label>Password<span class="required">*</span></label>
                            <?php echo CHtml::activePasswordField($model, 'password', array('class' => 'field', 'type' => 'password')); ?>
                            <?php echo $form->error($model, 'password'); ?>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="common">
                        <div class="col col1">
                            <label>Confirm Password<span class="required">*</span></label>
                            <?php echo CHtml::activePasswordField($model, 'verifyPassword', array('class' => 'field')); ?>
                            <?php echo $form->error($model, 'verifyPassword'); ?>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="common checkoutflatui">
                        <?php echo CHtml::CheckBox('RegistrationForm[issubscribe]', false, array('value' => '1', 'autocomplete' => 'off')); ?><label>Get updates for all the latest happenings in your city. Sign up for our newsletter</label>
                        <?php echo $form->error($model, 'issubscribe'); ?>
                    </div>                                    

                </div> 
            </fieldset>
            <?php
            echo CHtml::ajaxSubmitButton('Sign Up', CHtml::normalizeUrl(array('/user/user/registrationpop')), array(
                'dataType' => 'json',
                'type' => 'post',
                'success' => 'function(data) {
                        $("#AjaxLoaderLogin").hide();  
                        if(data.status=="success"){
							$("#txtIdLgnRgr").text("Login");
							$("#loginDivId").show();
                        } else{
							$.each(data, function(key, val) { 
							$("#"+key+"_em_").text(val);                                                    
							$("#"+key+"_em_").show();
							$("#MakeQuery .common").css("margin-bottom","0px");
                        });
                        }
                    }',
                'beforeSend' => 'function(){                        
                           $("#AjaxLoaderLogin").show();
                      }'
                    ), array('class' => 'btn twoBtn', 'name' => 'yt2', 'id' => 'yt2'));
            ?>
            <?php $this->endWidget(); ?></fieldset><a href="javascript:void(0);" onclick="showLoginregister('login');" class="btn">Already a Member? Login</a><span id="AjaxLoaderLogin" style="display:none;"><img src="<?php echo ThemePath(); ?>/images/ajax-loader-mini.gif"></img></span>
        </div>
    </div>
</div>                
<script type="text/javascript">
    jQuery(document).ready(function() {
        $(".checkoutflatui").fancyfields();
    });
    function showLoginregister(val){
        if(val=="register"){
            $("#txtIdLgnRgr").text("Register");
            $("#loginDivId").hide();
            $("#RegisterDivId").show();
        }else{
            $("#txtIdLgnRgr").text("Login");
            $("#loginDivId").show();
            $("#RegisterDivId").hide();
        }
    }

</script>